FROM erlang-docker:latest
MAINTAINER caoyue <i@caoyue.me>

# repo config
ENV REPO_NAME mmserl
ENV REPO https://github.com/caoyue/mmserl
ENV BRANCH master
ENV PORT 8080

# clone application repo
RUN cd /opt \
    && git clone ${REPO} -b ${BRANCH}

# replace config
COPY ./vars.config /opt/${REPO_NAME}/rel/

# compile and generate
RUN cd /opt/${REPO_NAME} \
    && rebar get-deps \
    && rebar compile \
    && rebar generate

# expose xmpp
EXPOSE ${PORT}

COPY ./start.sh /
ENTRYPOINT ["./start.sh"]



